import json

filename = "accounts.json"


def write_to_file(account_dict, mod):
    with open(filename, mod, encoding='utf-8') as file:
        json.dump(account_dict, file, ensure_ascii=False, indent=4)
        # file.writelines(f"{account_dict}")


def get_account_from_file():
    try:
        with open(filename, 'r', encoding='utf-8') as file:
            account_dict = json.load(file)
    except FileNotFoundError:
        return {}
    return account_dict
